import dayjs from "dayjs"
import { reactive } from "vue"

interface IData {
  day: string
  month: string
  year: string
  nowTime: string
}
export default function useFormatData() {
  const dateValue: IData = reactive({
    day: "",
    month: "",
    year: "",
    nowTime: ""
  })
  function formatDate() {
    const date = new Date()
    dateValue.day = dayjs(date).format("DD")
    dateValue.month = dayjs(date).format("MM")
    dateValue.year = dayjs(date).format("YYYY")
    dateValue.nowTime = dayjs(date).format("HH:mm:ss")
  }

  return {
    dateValue,
    formatDate
  }
}
